package com.ciei.dpagm.controller;

import com.alibaba.fastjson.JSONObject;
import com.ciei.dpagm.service.HomePageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author kiho
 * @date 2023/09/16
 */
@RestController
@RequestMapping("homePage")
public class HomePageController {

    @Autowired
    private HomePageService homePageService;

    @RequestMapping("countChipDistribution")
    @ResponseBody
    public JSONObject countChipDistribution(@RequestBody(required = false) JSONObject data) {
        return homePageService.countChipDistribution(data);
    }

    @RequestMapping("countDriverDistribution")
    @ResponseBody
    public JSONObject countDriverDistribution(@RequestBody(required = false) JSONObject data) {
        return homePageService.countDriverDistribution(data);
    }

    @RequestMapping("countProjectDistribution")
    @ResponseBody
    public JSONObject countProjectDistribution(@RequestBody(required = false) JSONObject data) {
        return homePageService.countProjectDistribution(data);
    }

    @RequestMapping("countChipUsage")
    @ResponseBody
    public JSONObject countChipUsage(@RequestBody(required = false) JSONObject data) {
        return homePageService.countChipUsage(data);
    }
}
